package com.kwlt.smc.entity;

import java.util.List;

import javax.persistence.CollectionTable;
import javax.persistence.Column;
import javax.persistence.ElementCollection;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.Table;
import javax.persistence.Transient;

import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;
import org.springframework.transaction.annotation.Transactional;

import com.google.common.collect.Lists;

/**
 * 	部门�?
 * @author xushunxin
 *
 */

@Entity
@Table(name="DEPT")
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
public class Dept {
	private Long deptId;
	/**
	 * 部门名称
	 */
	private String deptName;
	
	/**
	 * 权限编码列表
	 */
	private List<String> authList = Lists.newArrayList();
	/**
	 * 权限编码
	 */
	private String authCodeString;
	
	private String deptNumbers;
	
	public Dept(){
		
	}
	@Id
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	public Long getDeptId() {
		return deptId;
	}

	public void setDeptId(Long deptId) {
		this.deptId = deptId;
	}
	@Column(nullable=false,length = 50)
	public String getDeptName() {
		return deptName;
	}

	public void setDeptName(String deptName) {
		this.deptName = deptName;
	}
	
	@ElementCollection
	@CollectionTable(name = "DEPT_AUTH", joinColumns = { @JoinColumn(name = "DEPT_ID") })
	@Column(name = "AUTH_CODE")
	@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
	public List<String> getAuthList() {
		return authList;
	}

	public void setAuthList(List<String> authList) {
		this.authList = authList;
	}
	
	@Transient	
	public String getAuthCodeString() {
		return authCodeString;
	}
	public void setAuthCodeString(String authCodeString) {
		this.authCodeString = authCodeString;
	}
	public String getDeptNumbers() {
		return deptNumbers;
	}
	public void setDeptNumbers(String deptNumbers) {
		this.deptNumbers = deptNumbers;
	}
	
	
}
